package com.datou.controller;

import com.datou.datouspringmvc.annotation.Controller;
import com.datou.datouspringmvc.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
public class UserController {

    @RequestMapping("/user/list")
    public void listUser(HttpServletRequest request, HttpServletResponse response) {
        response.setContentType("text/html;charset=utf-8");

        try {
            response.getWriter().write("<h1>用户列表</h1>");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }

    @RequestMapping("/user/add")
    public void addUser(HttpServletRequest request, HttpServletResponse response) {
        response.setContentType("text/html;charset=utf-8");

        try {
            response.getWriter().write("<h1>用户添加</h1>");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
